import { ChatOpenAI } from "@langchain/openai";
import { HumanMessage, SystemMessage } from "@langchain/core/messages";



const model = new ChatOpenAI({
    apiKey: "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",
    model: "gpt-4o-mini" ,
    // baseURL: "https://api.openai.com/v1" // 可替换为第三方 API 地址
});
const messages = [
    new SystemMessage("Translate the following from English into Italian"),
    new HumanMessage("hi!"),
];

const res=await model.invoke(messages);
console.log(res);